package com.mooco.dongba.sys.dao;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SysRoleMenuDao {
    List<Integer> findMenuIdsByRoleIds(List<Integer> roleIds);

    @Delete("delete from sys_role_menus where menu_id=#{menuId}")
    int deleteObjectByMenuId(Integer menuId);

    @Delete("delete from sys_role_menus where role_id=#{roleId}")
    int deleteObjectByRoleId(Long roleId);

    int insertObjects(@Param("roleId") Long roleId, @Param("menuIds") Integer[] menuIds);

    @Select("select menu_id from sys_role_menus where role_id=#{roleId}")
    List<Integer> findMenuIdsByRoleId(@Param("roleId") Long roleId);
}
